
@echo on
set PATH="%~dp0";%PATH%
set PATH="%~dp0InnoSetup5Lite";%PATH%
cd /d "%~dp0"
if not exist "%~dp0InnoSetup5Lite" (7za x "%~dp0InnoSetup5Lite.7z" -o"%~dp0" -y)


cd /d %~dp0
if not exist Output mkdir Output
if not exist MaterialTestFSS mkdir MaterialTestFSS
if not exist MaterialTestPkg mkdir MaterialTestPkg
if exist Output (del Output\*.* /q /s)


cd /d %~dp0
xcopy ..\BinZ\Release\*.dll  MaterialTestPkg   /y /q
xcopy ..\BinZ\Release\*.exe  MaterialTestPkg /y /q
xcopy ..\RunNdBob  MaterialTestPkg  /s /y  /q
xcopy VCRTZ  MaterialTestPkg   /s  /y  /q



cd /d %~dp0
cd /d MaterialTestPkg
call ../TGenClear.bat



echo Get Ver
cd /d %~dp0../MaterialTest
call version.bat
echo Version %major_ver%.%minor_ver%.%revsion_ver%.%revnum% %revset%
for /f "tokens=2 delims==" %%a in ('wmic path win32_operatingsystem get LocalDateTime /value') do (
  set t=%%a
)
set datetime=%t:~0,4%_%t:~4,2%%t:~6,2%_%t:~8,2%%t:~10,2%
set curversion=%major_ver%.%minor_ver%.%revsion_ver%.%revnum%
echo %datetime% %curversion%



cd /d "%~dp0"
echo ISCC begin
ISCC.exe SetupAA.iss
echo ISCC end



set TARGET_NAME=MaterialTest%major_ver%.%minor_ver%.%revsion_ver%.%revnum%


cd /d %~dp0Output
move MaterialTest.exe %TARGET_NAME%.exe
@ping 127.0.0.1 -n 1 >nul


cd /d %~dp0
move "Output\%TARGET_NAME%.exe" "MaterialTestFSS\%TARGET_NAME%.exe" 
@ping 127.0.0.1 -n 1 >nul

rmdir Output

@ping 127.0.0.1 -n 5 >nul


